www.gusucode.com > 马尔可夫(MRF)图像分割MATLAB源码 > 马尔可夫(MRF)图像分割MATLAB源码/matlab_MRF/matlab MRF toy examples/runBP.m
% runBP.m % script initializes things and runs the BP functions. % Sept. 3, 2003 wtf created. See notesJuly11.txt for documentation. initPaths; initZoom; nIter = 10; n0 = 1; delta = 0.2; [segmentations{n0}, depths{n0}, disparImage{n0}, lhoods{n0}] = ... getSegDisp(images, rect, calib, n0, dset, sigma); segments = segmentations{n0}; lhoods = lhoods{n0}; [neighborMat] = getNeighborMat(segments); propMat = makePropMat(delta, length(dset)); nodes = initNodes (neighborMat, lhoods); figure; ind = 7; for i = 1:nIter nodes = propNodes(nodes, propMat); nodes = computeBeliefs(nodes); subplot(nIter,1,i); plot(nodes{ind}.belief); end;